<%--
  Created by IntelliJ IDEA.
  User: Jing
  Date: 2024/11/12
  Time: 20:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri ="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>学生信息管理</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
<%--    <script src="js/jquery-3.4.1.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>--%>
    <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/css2.css" rel="stylesheet">
    <%--    <link href="css/all.min.css" rel="stylesheet">--%>
    <%--    <link href="css/bootstrap-icons.css" rel="stylesheet">--%>
    <%--    <link href="css/owl.carousel.min.css" rel="stylesheet">--%>
    <link href="css/style.css" rel="stylesheet">
    <link href="css/messageBox.css" rel="stylesheet">

    <script>
        window.onload = function() {
            var errorMessage = "${errorMessage}";
            var successMessage = "${successMessage}";
            var messageBox = document.getElementById('messageBox');

            if (errorMessage) {
                messageBox.textContent = errorMessage;
                messageBox.style.display = 'block';
                setTimeout(function() {
                    messageBox.style.display = 'none';
                }, 2000);
            } else if (successMessage) {
                messageBox.textContent = successMessage;
                messageBox.style.display = 'block';
                setTimeout(function() {
                    messageBox.style.display = 'none';
                }, 2000);
            }
        };
    </script>
</head>
<body>
<div class="container-fluid position-relative bg-white d-flex p-0">

    <div class="sidebar pe-4 pb-3">
        <nav class="navbar bg-light navbar-light">
            <a href="classes?action=list" class="navbar-brand mx-4 mb-3">
                <h3 class="text-primary">网上请假系统</h3>
            </a>
            <div class="navbar-nav w-100">
                <a href="classes?action=list" class="nav-item nav-link">班级信息管理</a>
                <a href="course?action=list" class="nav-item nav-link">班级课程信息管理</a>
                <a href="student?action=list" class="nav-item nav-link active">学生信息管理</a>
                <a href="leave?action=listAudit" class="nav-item nav-link">审核请假单</a>
                <a href="leave?action=listExport" class="nav-item nav-link">导出请假名单</a>
            </div>
        </nav>
    </div>

    <div class="content">
        <nav class="navbar navbar-expand bg-light navbar-light px-4 py-0" style="height: 48px;">

            <form action="student" method="get">
                <div class="d-none d-md-flex ms-4">
                    <input style="margin-top: 36px;width: 680px;background-color: #f0f0f0;" class="form-control border-0" type="text" id="stuID" placeholder="请输入关键字" name="keyword">
                    <button type="submit" class="btn btn-outline-primary" style="width: 80px;margin-top: 35px !important;margin-left: 5px;">查询</button>
                    <input type="hidden" name="action" value="seek">
                </div>
            </form>
            <div class="d-flex align-items-center justify-content-between mb-4">
                <form action="student" method="get">
                    <button type="submit" class="btn btn-outline-primary" style="width: 99px;margin-top: 58px !important;margin-left: 10px;">查看全部</button>
                    <input type="hidden" name="action" value="list">
                </form>
                <button type="button" class="btn btn-outline-success" data-toggle="modal" data-target="#staticBackdrop" style="width: 80px;margin-left: 10px;margin-top: 41px;">添加</button>
                <form action="student?action=add" id="addStudenetForm" method="post">
                    <div class="modal fade" id="staticBackdrop" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h5 class="modal-title" id="staticBackdropLabel">添加学生</h5>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true">&times;</span>
                                    </button>
                                </div>
                                <div class="modal-body" style="text-align: left;">
                                    <p>
                                    <div class="form-group">
                                        <label for="stuID">学号：</label>
                                        <input type="text" class="form-control" placeholder="stuID" name="stuID" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="stuID">班号：</label>
                                        <input type="text" class="form-control" placeholder="classID" name="classID" required>
                                    </div>

                                    <div class="form-group">
                                        <label for="stuID">姓名：</label>
                                        <input type="text" class="form-control" placeholder="stuName" name="stuName" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="stuID">性别：</label>
                                        <input type="text" class="form-control" placeholder="sex" name="sex" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="stuID">通讯地址：</label>
                                        <input type="text" class="form-control" placeholder="address" name="address" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="stuID">学生电话：</label>
                                        <input type="text" class="form-control" placeholder="stuTel" name="stuTel" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="stuID">联系人：</label>
                                        <input type="text" class="form-control" placeholder="contact" name="contact" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="stuID">联系电话：</label>
                                        <input type="text" class="form-control" placeholder="contactTel" name="contactTel" required>
                                    </div>
                                    </p>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                                    <button type="submit" class="btn btn-primary">确定</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>

            <div class="navbar-nav align-items-center ms-auto" style="">
                <div class="nav-item dropdown">
                    <a href="login.jsp" class="btn btn-outline-danger" style="margin-top: 17px; width: 65px; margin-left: 70px; display: inline-block;">退出</a>
                    <input type="hidden" name="action" value=".../login.jsp">
                </div>
            </div>
        </nav>
        <div class="shadow-sm p-3 mb-5 bg-white rounded">
            <div class="container-fluid pt-4 px-4" style="background-color: #efefef;">
            <div class="bg-light text-center rounded p-4" style="height: 630px !important;">
                <%--                <form  action="classes" method="get">--%>

                <%--                </form>--%>
                <form>
                    <%--                    <div class="table-responsive">--%>
                    <table class="table text-start align-middle table-bordered table-hover mb-0" >
                        <thead>
                        <tr>
                            <th scope="col"><input  type="checkbox"></th>
                            <th scope="col">学号</th>
                            <th scope="col">班号</th>
                            <th scope="col">姓名</th>
                            <th scope="col">性别</th>
                            <th scope="col">通讯地址</th>
                            <th scope="col">学生电话</th>
                            <th scope="col">联系人</th>
                            <th scope="col">联系电话</th>
                            <th scope="col">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${list}" var="student_list">
                            <tr>
                                <td><input  type="checkbox"></td>
                                <td>${student_list.stuID}</td>
                                <td>${student_list.classID}</td>
                                <td>${student_list.stuName}</td>
                                <td>${student_list.sex}</td>
                                <td>${student_list.address}</td>
                                <td>${student_list.stuTel}</td>
                                <td>${student_list.contact}</td>
                                <td>${student_list.contactTel}</td>
                                <td>
                                    <div style="display: flex;">
                                        <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#exampleModalCenter-${student_list.stuID}">修改</button>
                                        <form action="student?action=edit&stuID=${student_list.stuID}" method="post">
                                            <div class="modal fade" id="exampleModalCenter-${student_list.stuID}" tabindex="-1" aria-labelledby="exampleModalCenterTitle" aria-hidden="true" >
                                                <div class="modal-dialog modal-dialog-centered">
                                                    <div class="modal-content">
                                                        <div class="modal-header">
                                                            <h5 class="modal-title" id="exampleModalCenterTitle">修改学生信息- ${student_list.stuName}</h5>
                                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                                <span aria-hidden="true">&times;</span>
                                                            </button>
                                                        </div>

                                                        <div class="modal-body">
                                                            <p>
                                                                <input type="hidden" name="stuID" value="${student_list.stuID}">
                                                                    <%--                                                                <input type="hidden" name="classID" value="${classes_list.classID}">--%>
                                                            <div class="form-group">
                                                                <label for="stuID-${student_list.stuID}">学号：</label>
                                                                <input type="text" class="form-control" placeholder="stuID" name="stuID" value="${student_list.stuID}" required>
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="classID-${student_list.stuID}">班号：</label>
                                                                <input type="text" class="form-control" placeholder="classID" name="classID" value="${student_list.classID}" required>
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="stuName-${student_list.stuID}">姓名：</label>
                                                                <input type="text" class="form-control" placeholder="stuName" name="stuName" value="${student_list.stuName}" required>
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="sex-${student_list.stuID}">性别：</label>
                                                                <input type="text" class="form-control" placeholder="sex" name="sex" value="${student_list.sex}" required>
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="address-${student_list.stuID}">通讯地址：</label>
                                                                <input type="text" class="form-control" placeholder="address" name="address" value="${student_list.address}" required>
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="stuTel-${student_list.stuID}">学生电话：</label>
                                                                <input type="text" class="form-control" placeholder="stuTel" name="stuTel" value="${student_list.stuTel}" required>
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="contact-${student_list.stuID}">联系人：</label>
                                                                <input type="text" class="form-control" placeholder="contact" name="contact" value="${student_list.contact}" required>
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="contactTel-${student_list.stuID}">联系电话：</label>
                                                                <input type="text" class="form-control" placeholder="contactTel" name="contactTel" value="${student_list.contactTel}" required>
                                                            </div>
                                                            </p>
                                                        </div>
                                                        <div class="modal-footer">
                                                            <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                                                            <button type="submit" class="btn btn-primary">确定</button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </form>

                                        <button type="button" class="btn btn-outline-danger btn-sm" data-toggle="modal" data-target="#exampleModal-${student_list.stuID}" style="margin-left: 10px;">删除</button>
                                        <form action="student?action=delete&stuID=${student_list.stuID}" method="post">
                                            <input type="hidden" name="stuID" value="${student_list.stuID}">
                                            <div class="modal fade" id="exampleModal-${student_list.stuID}" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
                                                <div class="modal-dialog">
                                                    <div class="modal-content">
                                                        <div class="modal-header">
                                                            <h5 class="modal-title" id="exampleModalLabel">确定要删除该学生信息：${student_list.stuName}吗？</h5>
                                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                                <span aria-hidden="true">&times;</span>
                                                            </button>
                                                        </div>

                                                        <div class="modal-footer">
                                                            <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                                                            <button type="submit" class="btn btn-primary">确定</button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
        </div>
    </div>
</div>

<div id="messageBox"></div>
<%--<script src="js/bootstrap.bundle.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>--%>
<script src="js/main.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
<%--<script src="js/rocket-loader.min.js" data-cf-settings="4bebc94b2db97a1f9680a39f-|49" defer=""></script>--%>
</body>
</html>
